package com.byx.imclientutil.entity;

import androidx.annotation.NonNull;

/**
 * ImMessage
 *
 * @author Superb
 * @date 2021/2/9 16:45
 */
public class BaseMessage {
    private String id;
    private int type;
    private int contentType;
    private String senderId;
    private String recipientId;
    private long timestamp;
    private int status;
    private String content;

    public BaseMessage(Builder builder) {
        if(null != builder){
            this.id= builder.id;
            this.type= builder.type;
            this.contentType= builder.contentType;
            this.senderId= builder.senderId;
            this.recipientId= builder.recipientId;
            this.timestamp= builder.timestamp;
            this.status= builder.status;
            this.content=builder.content;
        }
    }

    public String getId() {
        return id;
    }

    public int getType() {
        return type;
    }

    public int getContentType() {
        return contentType;
    }

    public String getSenderId() {
        return senderId;
    }

    public String getRecipientId() {
        return recipientId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public int getStatus() {
        return status;
    }

    public String getContent() {
        return content;
    }

    @NonNull
    @Override
    public String toString() {
        return "ImMessage{" +
                "id=" + id +
                ", type=" + type +
                ", contentType=" + contentType +
                ", senderId=" + senderId +
                ", recipientId=" + recipientId +
                ", timestamp=" + timestamp +
                ", status=" + status +
                ", content='" + content + '\'' +
                '}';
    }

    public static class Builder {
        private String id;
        private int type;
        private int contentType;
        private String senderId;
        private String recipientId;
        private long timestamp;
        private int status;
        private String content;

        public Builder() {
        }

        public Builder setId(String id) {
            this.id = id;
            return this;
        }

        public Builder setType(int type) {
            this.type = type;
            return this;
        }

        public Builder setContentType(int contentType) {
            this.contentType = contentType;
            return this;
        }

        public Builder setSenderId(String senderId) {
            this.senderId = senderId;
            return this;
        }

        public Builder setRecipientId(String recipientId) {
            this.recipientId = recipientId;
            return this;
        }

        public Builder setTimestamp(long timestamp) {
            this.timestamp = timestamp;
            return this;
        }

        public Builder setStatus(int status) {
            this.status = status;
            return this;
        }

        public Builder setContent(String content) {
            this.content = content;
            return this;
        }

        public BaseMessage build() {
            return new BaseMessage(this);
        }
    }
}
